<template>
  <div>
    <basic-dialog
      :icon="icon"
      :title="title"
      width="850px"
      height="85%"
      v-bind="$attrs"
      @close="close"
      :openFlag="openEdit"
    >
      <template #content>
        <el-form label-width="140px" label-position="right" :model="form">
          <el-row>
            <el-col span="24">
              <el-form-item label="涉及粉尘生产工艺">
                <el-select v-model="form.dustProductionTech" style="width: 98.5%" size="small">
                  <el-option v-for="item in dictConfig.entDustProductionTech" :key="item.id" :value="item.dictValue" :label="item.dictValueName"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col span="12">
              <el-form-item label="粉尘种类">
                <el-select v-model="form.dustType" :style="`width:${width}` " size="small">
                  <el-option v-for="item in dictConfig.entDustType" :key="item.id" :value="item.dictValue" :label="item.dictValueName"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col span="12">
              <el-form-item label="日产尘量 ">
                <el-input-number v-model="form.dailyDustProduction" :style="`width:${width}` " size="small"></el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col span="12">
              <el-form-item label="所属行业">
                <el-input v-model="form.industry" :style="`width:${width}` " size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col span="12">
              <el-form-item label="涉及职业病危害因素">
                <el-input v-model="form.isOccupationFactor" :style="`width:${width}` " size="small"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col span="12">
              <el-form-item label="所属部门">
                <el-input v-model="form.affiliatedFunctionId" :style="`width:${width}` " size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col span="12">
              <el-form-item label="涉粉作业场所名称">
                <el-input v-model="form.workplaceName" :style="`width:${width}` " size="small"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col span="12">
              <el-form-item label="涉粉作业场所人数">
                <el-input-number v-model="form.workermillNum" :style="`width:${width}` " size="small"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col span="12">
              <el-form-item label="涉粉单班作业人数">
                <el-input-number v-model="form.workerSingleClassNum" :style="`width:${width}` " size="small"></el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col span="12">
              <el-form-item label="除尘器种类">
                <el-radio-group v-model="form.dustRemoverClass">
                  <el-radio :label="3">集中除尘系统</el-radio>
                  <el-radio :label="6">单机除尘设备</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col span="12">
              <el-form-item label="除尘器类型" v-model="form.dustRemoverType">
                <el-input :style="`width:${width}` " size="small"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col span="12">
              <el-form-item label="除尘器数量">
                <el-input-number v-model="form.quantityDustCollector" :style="`width:${width}` " size="small"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col span="12">
              <el-form-item label="是否安装监控">
                <el-radio-group v-model="form.isMonitor">
                  <el-radio :label="item.dictValue" v-for="item in dictConfig.commonJudge" :key="item.id">
                    {{ item.dictValueName }}
                  </el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col span="12">
              <el-form-item label="是否建立粉尘清扫制度">
                <el-radio-group v-model="form.isDustCleanSystem">
                  <el-radio :label="item.dictValue" v-for="item in dictConfig.commonJudge" :key="item.id">
                    {{ item.dictValueName }}
                  </el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col span="12">
              <el-form-item label="是否涉爆">
                <el-radio-group v-model="form.isExplosion">
                  <el-radio :label="item.dictValue" v-for="item in dictConfig.commonJudge" :key="item.id">
                    {{ item.dictValueName }}
                  </el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col>
              <el-form-item label="图片">
                <basic-upload
                  @onSuccess="onSuccess"
                  @onRemove="onRemove"
                  :photos="form.picture"
                ></basic-upload>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col>
              <el-form-item label="上传附件">
                <basic-upload
                  :model="true"
                  @onSuccess="onSuccess"
                  @onRemove="onRemove"
                  :photos="form.file"
                ></basic-upload>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col>
              <el-form-item label="备注">
                <el-input v-model="form.remark" style="width: 98.5%" size="small"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </template>
      <template #bottom>
        <div>
          <el-button type="primary" @click="submitForm('form')"
          >保存</el-button
          >
          <el-button type="success" @click="resetForm('form')"
          >重置</el-button
          >
          <el-button type="warning" @click="close">取消</el-button>
        </div>
      </template>
    </basic-dialog>
  </div>
</template>
<script>
export default {
  name: "editDialog",
  data() {
    return {
      icon: 'icon-bianji',
      title: '新增粉尘信息',
      openEdit: false,
      width: "260px",
      form:{}
    }
  },
  props:{
    dictConfig:{
      type:Object,
      default(){
        return {}
      }
    }
  },
  methods: {
    open() {
      this.openEdit = true
    },
    close() {
      this.openEdit = false
    },
    /**
     * 提交表单
     */
    submitForm(){
      console.log(this.form,'form')
    },
    resetForm(){

    },
    onSuccess(){

    },
    onRemove(){

    }
  }
}
</script>

<style scoped lang="scss">
/deep/ .el-form-item {
  margin-bottom: 8px !important;
}
/deep/ .el-form-item__error{
  line-height: 2px;
}
</style>
